A Complete Type Inference System for Subtyped Recursive Types
نویسندگان
چکیده
Since record polymorphism is one of essential factors for object-oriented languages, various approaches to incorporate record polymorphism into type systems have been proposed to lay the foundation for object-oriented languages. Recursive types, which are essentially types of lists or trees, are major programming tools. In object-oriented languages, a pseudo variable \self" has a recursive type, which requires that type systems be able to treat recursive types. The purpose of this paper is to provide a type system and its type inference algorithm which can handle subtyping, recursive types and parametric polymorphism without any kind of type declaration or unnatural restrictions. We prove soundness and completeness of the type inference algorithm. Our system integrates subtyping and recursive types into Damas and Milner's type system and preserves important properties such as existence of principal typing. The basic idea is that we consider a type as a regular tree.
منابع مشابه
Type Inference with Simple Selftypes is NP-complete
The metavariable self is fundamental in object-oriented languages. Typing self in the presence of inheritance has been studied by Abadi and Cardelli, Bruce, and others. A key concept in these developments is the notion of selftype, which enables flexible type annotations that are impossible with recursive types and subtyping. Bruce et al. demonstrated that, for the language TOOPLE, type checkin...
متن کاملDepth Subtyping and Type Inference for Object Calculi
We present a new type system based on the notion of Split types. In this system, every method is assigned two types, namely, an update type and a select type. We show that the system of Split types is strictly more powerful than the system of recursive types and that type inference remains decidable and feasible. We include a number of interesting examples not typable with recursive types that ...
متن کاملType Reconstruction for the Linear π-Calculus with Composite and Equi-Recursive Types
We generalize the linear π-calculus so that multiple processes can access the same composite, possibly recursive data structure containing linear values, provided that there is no overlapping access on such values. We define a complete type reconstruction algorithm for the type system. En passant, we solve the problem of reconstruction for equi-recursive session types.
متن کاملOptimal Representations of Polymorphic
Many type inference and program analysis systems include notions of subtyping and parametric polymorphism. When used together, these two features induce equivalences that allow types to be simpliied by eliminating quantiied variables. Eliminating variables both improves the readability of types and the performance of algorithms whose complexity depends on the number of type variables. We presen...
متن کاملRank 2 Type Systems and Recursive Deenitions Technical Memorandum Mittlcsstmm531
We demonstrate an equivalence between the rank 2 fragments of the polymorphic lambda calculus (System F) and the intersection type discipline: exactly the same terms are typable in each system. An immediate consequence is that typability in the rank 2 intersection system is DEXPTIME-complete. We introduce a rank 2 system combining intersections and polymorphism, and prove that it types exactly ...
متن کامل